home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / AppleGuide.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  9.9 KB  |  318 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        AppleGuide.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __APPLEGUIDE__
  18. #define __APPLEGUIDE__
  19.  
  20.  
  21. #ifndef __APPLEEVENTS__
  22. #include <AppleEvents.h>
  23. #endif
  24. /*    #include <Errors.h>                                            */
  25. /*        #include <ConditionalMacros.h>                            */
  26. /*    #include <Types.h>                                            */
  27. /*    #include <Memory.h>                                            */
  28. /*        #include <MixedMode.h>                                    */
  29. /*    #include <OSUtils.h>                                        */
  30. /*    #include <Events.h>                                            */
  31. /*        #include <Quickdraw.h>                                    */
  32. /*            #include <QuickdrawText.h>                            */
  33. /*    #include <EPPC.h>                                            */
  34. /*        #include <PPCToolbox.h>                                    */
  35. /*            #include <AppleTalk.h>                                */
  36. /*        #include <Processes.h>                                    */
  37. /*            #include <Files.h>                                    */
  38. /*    #include <Notification.h>                                    */
  39.  
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43.  
  44. #if GENERATINGPOWERPC
  45. #pragma options align=mac68k
  46. #endif
  47.  
  48. #ifdef __CFM68K__
  49. #pragma lib_export on
  50. #endif
  51.  
  52. typedef UInt32 AGRefNum;
  53.  
  54. typedef UInt32 AGCoachRefNum;
  55.  
  56. typedef UInt32 AGContextRefNum;
  57.  
  58. struct AGAppInfo {
  59.     AEEventID                        eventId;
  60.     long                            refCon;
  61.     void                            *contextObj;                /* private system field*/
  62. };
  63. typedef struct AGAppInfo AGAppInfo, *AGAppInfoPtr, **AGAppInfoHdl;
  64.  
  65. typedef pascal OSErr (*CoachReplyProcPtr)(Rect *pRect, Ptr name, long refCon);
  66. typedef pascal OSErr (*ContextReplyProcPtr)(Ptr pInputData, Size inputDataSize, Ptr *ppOutputData, Size *pOutputDataSize, AGAppInfoHdl hAppInfo);
  67.  
  68. #if GENERATINGCFM
  69. typedef UniversalProcPtr CoachReplyUPP;
  70. typedef UniversalProcPtr ContextReplyUPP;
  71. #else
  72. typedef CoachReplyProcPtr CoachReplyUPP;
  73. typedef ContextReplyProcPtr ContextReplyUPP;
  74. #endif
  75.  
  76. enum {
  77.     uppCoachReplyProcInfo = kPascalStackBased
  78.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  79.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Rect*)))
  80.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Ptr)))
  81.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))),
  82.     uppContextReplyProcInfo = kPascalStackBased
  83.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  84.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Ptr)))
  85.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Size)))
  86.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Ptr*)))
  87.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Size*)))
  88.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(AGAppInfoHdl)))
  89. };
  90.  
  91. #if GENERATINGCFM
  92. #define NewCoachReplyProc(userRoutine)        \
  93.         (CoachReplyUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCoachReplyProcInfo, GetCurrentArchitecture())
  94. #define NewContextReplyProc(userRoutine)        \
  95.         (ContextReplyUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppContextReplyProcInfo, GetCurrentArchitecture())
  96. #else
  97. #define NewCoachReplyProc(userRoutine)        \
  98.         ((CoachReplyUPP) (userRoutine))
  99. #define NewContextReplyProc(userRoutine)        \
  100.         ((ContextReplyUPP) (userRoutine))
  101. #endif
  102.  
  103. #if GENERATINGCFM
  104. #define CallCoachReplyProc(userRoutine, pRect, name, refCon)        \
  105.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppCoachReplyProcInfo, (pRect), (name), (refCon))
  106. #define CallContextReplyProc(userRoutine, pInputData, inputDataSize, ppOutputData, pOutputDataSize, hAppInfo)        \
  107.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppContextReplyProcInfo, (pInputData), (inputDataSize), (ppOutputData), (pOutputDataSize), (hAppInfo))
  108. #else
  109. #define CallCoachReplyProc(userRoutine, pRect, name, refCon)        \
  110.         (*(userRoutine))((pRect), (name), (refCon))
  111. #define CallContextReplyProc(userRoutine, pInputData, inputDataSize, ppOutputData, pOutputDataSize, hAppInfo)        \
  112.         (*(userRoutine))((pInputData), (inputDataSize), (ppOutputData), (pOutputDataSize), (hAppInfo))
  113. #endif
  114.  
  115.  
  116. enum {
  117.     gestaltAppleGuidePresent    = 31,
  118.     gestaltAppleGuideIsDebug    = 30,
  119.     kAGDefault                    = 0,
  120.     kAGFrontDatabase            = 1,
  121.     kAGNoMixin                    = (-1)
  122. };
  123.  
  124. enum {
  125.     kAGViewFullHowdy            = 1,                            /* Full-size Howdy*/
  126.     kAGViewTopicAreas            = 2,                            /* Full-size Topic Areas*/
  127.     kAGViewIndex                = 3,                            /* Full-size Index Terms*/
  128.     kAGViewLookFor                = 4,                            /* Full-size Look-For (Search)*/
  129.     kAGViewSingleHowdy            = 5,                            /* Single-list-size Howdy*/
  130.     kAGViewSingleTopics            = 6                                /* Single-list-size Topics*/
  131. };
  132.  
  133. enum {
  134.     kAGFileMain                    = 'poco',
  135.     kAGFileMixin                = 'mixn'
  136. };
  137.  
  138. /* To test against AGGetAvailableDBTypes*/
  139. enum AGDBTypeBit {
  140.     kAGDBTypeBitAny                = 0x00000001,
  141.     kAGDBTypeBitHelp            = 0x00000002,
  142.     kAGDBTypeBitTutorial        = 0x00000004,
  143.     kAGDBTypeBitShortcuts        = 0x00000008,
  144.     kAGDBTypeBitAbout            = 0x00000010,
  145.     kAGDBTypeBitOther            = 0x00000080
  146. };
  147.  
  148. typedef UInt16 AGStatus;
  149.  
  150. /* Returned by AGGetStatus*/
  151.  
  152. enum {
  153.     kAGIsNotRunning,
  154.     kAGIsSleeping,
  155.     kAGIsActive
  156. };
  157.  
  158. typedef UInt16 AGWindowKind;
  159.  
  160. /* Returned by AGGetFrontWindowKind*/
  161.  
  162. enum {
  163.     kAGNoWindow,
  164.     kAGAccessWindow,
  165.     kAGPresentationWindow
  166. };
  167.  
  168. /* Error Codes*/
  169. /* Not an enum, because other OSErrs are valid.*/
  170. typedef SInt16 AGErr;
  171.  
  172. /* Apple Guide error codes*/
  173.  
  174. enum {
  175. /* -------------------- Apple event reply codes*/
  176.     kAGErrUnknownEvent            = -2900,
  177.     kAGErrCantStartup            = -2901,
  178.     kAGErrNoAccWin                = -2902,
  179.     kAGErrNoPreWin                = -2903,
  180.     kAGErrNoSequence            = -2904,
  181.     kAGErrNotOopsSequence        = -2905,
  182.     kAGErrReserved06            = -2906,
  183.     kAGErrNoPanel                = -2907,
  184.     kAGErrContentNotFound        = -2908,
  185.     kAGErrMissingString            = -2909,
  186.     kAGErrInfoNotAvail            = -2910,
  187.     kAGErrEventNotAvailable        = -2911,
  188.     kAGErrCannotMakeCoach        = -2912,
  189.     kAGErrSessionIDsNotMatch    = -2913,
  190.     kAGErrMissingDatabaseSpec    = -2914,
  191. /* -------------------- Coach's Chalkboard reply codes*/
  192.     kAGErrItemNotFound            = -2925,
  193.     kAGErrBalloonResourceNotFound = -2926,
  194.     kAGErrChalkResourceNotFound    = -2927,
  195.     kAGErrChdvResourceNotFound    = -2928,
  196.     kAGErrAlreadyShowing        = -2929,
  197.     kAGErrBalloonResourceSkip    = -2930,
  198.     kAGErrItemNotVisible        = -2931,
  199.     kAGErrReserved32            = -2932,
  200.     kAGErrNotFrontProcess        = -2933,
  201.     kAGErrMacroResourceNotFound    = -2934,
  202. /* -------------------- API reply codes*/
  203.     kAGErrAppleGuideNotAvailable = -2951,
  204.     kAGErrCannotInitCoach        = -2952,
  205.     kAGErrCannotInitContext        = -2953,
  206.     kAGErrCannotOpenAliasFile    = -2954,
  207.     kAGErrNoAliasResource        = -2955,
  208.     kAGErrDatabaseNotAvailable    = -2956,
  209.     kAGErrDatabaseNotOpen        = -2957,
  210.     kAGErrMissingAppInfoHdl        = -2958,
  211.     kAGErrMissingContextObject    = -2959,
  212.     kAGErrInvalidRefNum            = -2960,
  213.     kAGErrDatabaseOpen            = -2961,
  214.     kAGErrInsufficientMemory    = -2962
  215. };
  216.  
  217. /* Events*/
  218. /* Not an enum because we want to make assignments.*/
  219. typedef UInt32 AGEvent;
  220.  
  221. /* Handy events for AGGeneral.*/
  222.  
  223. enum {
  224. /* Panel actions (Require a presentation window).*/
  225.     kAGEventDoCoach                = 'doco',
  226.     kAGEventDoHuh                = 'dhuh',
  227.     kAGEventGoNext                = 'gonp',
  228.     kAGEventGoPrev                = 'gopp',
  229.     kAGEventHidePanel            = 'pahi',
  230.     kAGEventReturnBack            = 'gobk',
  231.     kAGEventShowPanel            = 'pash',
  232.     kAGEventTogglePanel            = 'patg'
  233. };
  234.  
  235. /* Functions*/
  236. /* AGClose*/
  237. /* Close the database associated with the AGRefNum.*/
  238. extern pascal AGErr AGClose(AGRefNum *refNum)
  239.  TWOWORDINLINE(0x7011, 0xAA6E);
  240. /* AGGeneral*/
  241. /* Cause various events to happen.*/
  242. extern pascal AGErr AGGeneral(AGRefNum refNum, AGEvent theEvent)
  243.  TWOWORDINLINE(0x700D, 0xAA6E);
  244. /* AGGetAvailableDBTypes*/
  245. /* Return the database types available for this application.*/
  246. extern pascal UInt32 AGGetAvailableDBTypes(void)
  247.  TWOWORDINLINE(0x7008, 0xAA6E);
  248. /* AGGetFrontWindowKind*/
  249. /* Return the kind of the front window.*/
  250. extern pascal AGWindowKind AGGetFrontWindowKind(AGRefNum refNum)
  251.  TWOWORDINLINE(0x700C, 0xAA6E);
  252. /* AGGetFSSpec*/
  253. /* Return the FSSpec for the AGRefNum.*/
  254. extern pascal AGErr AGGetFSSpec(AGRefNum refNum, FSSpec *fileSpec)
  255.  TWOWORDINLINE(0x700F, 0xAA6E);
  256. /* AGGetStatus*/
  257. /* Return the status of Apple Guide.*/
  258. extern pascal AGStatus AGGetStatus(void)
  259.  TWOWORDINLINE(0x7009, 0xAA6E);
  260. /* AGInstallCoachHandler*/
  261. /* Install a Coach object location query handler.*/
  262. extern pascal AGErr AGInstallCoachHandler(CoachReplyUPP coachReplyProc, long refCon, AGCoachRefNum *resultRefNum)
  263.  TWOWORDINLINE(0x7012, 0xAA6E);
  264. /* AGInstallContextHandler*/
  265. /* Install a context check query handler.*/
  266. extern pascal AGErr AGInstallContextHandler(ContextReplyUPP contextReplyProc, AEEventID eventID, long refCon, AGContextRefNum *resultRefNum)
  267.  TWOWORDINLINE(0x7013, 0xAA6E);
  268. /* AGIsDatabaseOpen*/
  269. /* Return true if the database associated with the AGRefNum is open.*/
  270. extern pascal Boolean AGIsDatabaseOpen(AGRefNum refNum)
  271.  TWOWORDINLINE(0x7006, 0xAA6E);
  272. /* AGOpen*/
  273. /* Open a guide database.*/
  274. extern pascal AGErr AGOpen(FSSpec *fileSpec, UInt32 flags, Handle mixinControl, AGRefNum *resultRefNum)
  275.  TWOWORDINLINE(0x7001, 0xAA6E);
  276. /* AGOpenWithSearch*/
  277. /* Open a guide database and preset a search string.*/
  278. extern pascal AGErr AGOpenWithSearch(FSSpec *fileSpec, UInt32 flags, Handle mixinControl, ConstStr255Param searchString, AGRefNum *resultRefNum)
  279.  TWOWORDINLINE(0x7002, 0xAA6E);
  280. /* AGOpenWithSequence*/
  281. /* Open a guide database and display a presentation window sequence.*/
  282. extern pascal AGErr AGOpenWithSequence(FSSpec *fileSpec, UInt32 flags, Handle mixinControl, short sequenceID, AGRefNum *resultRefNum)
  283.  TWOWORDINLINE(0x7004, 0xAA6E);
  284. /* AGOpenWithView*/
  285. /* Open a guide database and override the default view.*/
  286. extern pascal AGErr AGOpenWithView(FSSpec *fileSpec, UInt32 flags, Handle mixinControl, short viewNum, AGRefNum *resultRefNum)
  287.  TWOWORDINLINE(0x7005, 0xAA6E);
  288. /* AGQuit*/
  289. /* Make Apple Guide quit.*/
  290. extern pascal AGErr AGQuit(void)
  291.  TWOWORDINLINE(0x7010, 0xAA6E);
  292. /* AGRemoveCoachHandler*/
  293. /* Remove the Coach object location query handler.*/
  294. extern pascal AGErr AGRemoveCoachHandler(AGCoachRefNum *resultRefNum)
  295.  TWOWORDINLINE(0x7014, 0xAA6E);
  296. /* AGRemoveContextHandler*/
  297. /* Remove the context check query handler.*/
  298. extern pascal AGErr AGRemoveContextHandler(AGContextRefNum *resultRefNum)
  299.  TWOWORDINLINE(0x7015, 0xAA6E);
  300. /* AGStart*/
  301. /* Start up Apple Guide in the background.*/
  302. extern pascal AGErr AGStart(void)
  303.  TWOWORDINLINE(0x700A, 0xAA6E);
  304.  
  305. #ifdef __CFM68K__
  306. #pragma lib_export off
  307. #endif
  308.  
  309. #if GENERATINGPOWERPC
  310. #pragma options align=reset
  311. #endif
  312.  
  313. #ifdef __cplusplus
  314. }
  315. #endif
  316.  
  317. #endif /* __APPLEGUIDE__ */
  318.